import subprocess
import sys
import os

def install_dependencies():
    print("正在安装依赖...")
    dependencies = [
        "PyQt5",
        "markdown"
    ]
    
    for dep in dependencies:
        print(f"安装 {dep}...")
        subprocess.check_call([sys.executable, "-m", "pip", "install", dep])
    
    print("所有依赖安装完成！")

def create_directories():
    print("创建项目目录...")
    directories = [
        "src",
        "data",
        "resources"
    ]
    
    for directory in directories:
        if not os.path.exists(directory):
            os.makedirs(directory)
            print(f"创建目录: {directory}")
    
    print("目录创建完成！")

def main():
    print("知识库管理系统 - 安装程序")
    print("=" * 40)
    
    install_dependencies()
    create_directories()
    
    print("\n安装完成！")
    print("您可以通过运行 'python src/main.py' 来启动知识库管理系统")

if __name__ == "__main__":
    main()